import 'package:boss/color_constant.dart';
import 'package:boss/models/takeout_order_list_data.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/takeoutManagement/constant/takeout_status.dart';
import 'package:boss/ui/widget/custom_divier.dart';
import 'package:boss/ui/widget/shadow_radius_card.dart';
import 'package:hi_common/hi_common.dart';
import 'package:flutter/material.dart';

import 'delivery_message.dart';
import 'order_message.dart';
import 'orderer_message.dart';

class TakeoutListItem extends StatelessWidget {
  final TakeoutOrderItem data;

  const TakeoutListItem({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return DefaultTextStyle(
      style: TextStyleConstant().normal_1_28,
      child: ShadowRadiusCard(
        margin: EdgeInsets.only(
          left: 30.w,
          right: 30.w,
          top: 30.w,
        ),
        padding: EdgeInsets.symmetric(),
        child: Column(
          children: <Widget>[
            Container(
              height: 82.w,
              padding: EdgeInsets.symmetric(horizontal: 20.w),
              decoration: BoxDecoration(
                  color: ColorConstant.ff5770f6.withOpacity(0.1),
                  borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(10.w),
                    topRight: Radius.circular(10.w),
                  )),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: <Widget>[
                  Row(
                    children: <Widget>[
                      Text('#${data.takeNo}', style: TextStyleConstant().blue_36),
                      if (data.type == TakeoutStatus.SELF_PICK)
                        Container(
                          margin: EdgeInsets.only(left: 15.w),
                          child: Text(
                            '自取',
                            style: TextStyleConstant().origin_28,
                          ),
                        ),
                    ],
                  ),
                  Text(data.statusName, style: TextStyleConstant().blue_24),
                ],
              ),
            ),
            OrdererMessage(data: data),
            CustomDivider(),
            OrderMessage(data: data),
            DeliverMessage(
              data: data,
            ),
          ],
        ),
      ),
    );
  }
}
